<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>dom-事件</title>
</head>
<body>

<button id="btnSubmit">提交</button>
</body>
<script>

    /*
     * 事件绑定：
     *    1. dom  :添加属性 onclick
     *    2. IE   ：addEventListener
    * */

    var btnSubmit = document.getElementById('btnSubmit');
   /* var btnSubmitClick =function(){
       ///step1
       // step2
       // step3
    }
    function btnSubmitClick(){
    }*/

  // btnSubmit.onclick =btnSubmitClick;

  /*  btnSubmit.onclick = function (event) {
      //console.log(event);
      console.log(event.target);
        console.log(event.target.id);

    }*/


    /*添加事件监听器*/
    btnSubmit.addEventListener('click',function () {
        alert('clicked');
    })

</script>

</html>